<template>
  <div class="main-container">
    <el-row type="flex">
      <div class="left-container">
        <infoUser :type="type" :userInfo="userinfolist" v-if="this.comonents.infoUser"></infoUser>
        <messageCenter v-if="this.comonents.messageCenter"></messageCenter>
        <examination v-if="this.comonents.examination"></examination>
      </div>
      <div class="right-container">
        <commonFunctions :commonFunctions="commonFunctions" v-if="this.comonents.commonFunctions"></commonFunctions>
        <div class="block-container">
          <div class="my-function">
            <worksheet v-if="this.comonents.worksheet"></worksheet>
            <curriculum :curriculumSearchDate="curriculumSearchDate" :dateOptions="dateOptions"
                        :curriculums="curriculums" v-if="this.comonents.curriculum"></curriculum>
          </div>
          <navigation v-if="this.userinfolist.type==='student' && this.comonents.navigation"
                      @func='toLink(url)'></navigation>
          <navigationTeacher v-if="this.userinfolist.type==='teacher' && this.comonents.navigation"></navigationTeacher>
          <director v-if="this.userinfolist.type==='director' && this.comonents.navigation"></director>
          <leadership v-if="this.userinfolist.type==='leadership' && this.comonents.navigation"></leadership>
          <EducationLeader v-if="this.userinfolist.type==='EducationLeader' && this.comonents.navigation"></EducationLeader>
          <captain v-if="this.userinfolist.type==='captain' && this.comonents.navigation"></captain>
          <battalionChief v-if="this.userinfolist.type==='battalionChief' && this.comonents.navigation"></battalionChief>
        </div>
      </div>
    </el-row>
  </div>
</template>

<script>
import {mapGetters} from "vuex";
import infoUser from "@/views/comonents/home/infoUser";
import messageCenter from "@/views/comonents/home/message-center";
import examination from "@/views/comonents/home/examination-arrangement";
import commonFunctions from "@/views/comonents/home/common-functions";
import worksheet from "@/views/comonents/home/worksheet";
import curriculum from "@/views/comonents/home/curriculum";
import navigation from "@/views/comonents/home/navigation-bar";
import navigationTeacher from "@/views/comonents/home/navigation-teacher";
import leadership from "@/views/leadership/home/index";
import EducationLeader from "@/views/EducationLeader/home/index";
import director from "@/views/director/home/index";
import captain from "@/views/captain/home/index";
import battalionChief from "@/views/battalionChief/home/index";


export default {
  components: {
    infoUser,
    messageCenter,
    examination,
    commonFunctions,
    worksheet,
    curriculum,
    navigation,
    navigationTeacher,
    // index,
    leadership,
    EducationLeader,
    director,
    captain,
    battalionChief
  },
  name: "index",
  data() {
    return {
      commonFunctions: [
        {
          name: "网上选课",
          img: require("../../assets/home/icon-function-course.png"),
          style: {color: "#5230E9", background: "#EBE6FF"},
          url: "/teacher/assessmentPlan",
        },
        {
          name: "网上评教",
          img: require("../../assets/home/icon-function-evaluation-teaching.png"),
          style: {color: "#51AEF6", background: "#E1F2FF"},
          url: "/teacher/assessmentEditPlan",
        },
        {
          name: "登记互联网课",
          img: require("../../assets/home/icon-function-internet-course.png"),
          style: {color: "#F86900", background: "#FDDCC3"},
          url: "/teacher/assessmentChangePlan",
        },
        {
          name: "填报互联网课成绩",
          img: require("../../assets/home/icon-function-school-report.png"),
          style: {color: "#F1B104", background: "#FFF6DC"},
          url: "/teacher/assessmentChangePlanDetail",
        },
        {
          name: "查询课程成绩",
          img: require("../../assets/home/icon-function-query-results.png"),
          style: {color: "#FF3819", background: "#FFD6CF"},
          url: "/teacher/assessmentPlan",
        },
        {
          name: "维护学籍信息",
          img: require("../../assets/home/icon-function-student-information.png"),
          style: {color: "#02C86C", background: "#DFFFEF"},
          url: "/teacher/assessmentPlan",
        },
      ],
      curriculums: [
        {
          name: "《法律经济学》",
          teacher: "李教员",
        },
        {
          name: "《法律经济学》",
          teacher: "李教员",
        },
        {
          name: "《法律经济学》",
          teacher: "李教员",
        },
        {
          name: "《法律经济学》",
          teacher: "李教员",
        },
      ],
      dateOptions: [
        {
          label: "2020春",
          value: "2020春",
        },
        {
          label: "2020秋",
          value: "2020秋",
        },
      ],
      curriculumSearchDate: "2020春",
    };
  },
  mounted() {
    this.log()
  },
  methods: {
    log: function () {
      // console.log(this.comonents, 'comonents')
    },
    toLink(url) {
      this.$router.push(url);
    },
  },
  computed: {
    ...mapGetters(["menu", 'userInfo', 'comonents']),
    userinfolist: function () {
      return {
        type: this.userInfo.role_name,
        num: "526213",
        company1: "学员42队",
        major: "财务管理",
        company2: "教研室",
        title: "财务管理",
      }
    }
  },
};
</script>

<style lang="less">
@import "../../styles/home";
</style>
